package com.wulian.gateway.feign;


import com.wulian.common.dto.UserDto;
import com.wulian.common.entity.AppResultMoudel;
import com.wulian.common.entity.SysUser;
import com.wulian.common.interceptor.FeignConfigInterceptor;
import com.wulian.common.vo.ResultMoudel;
import com.wulian.common.vo.UserVO;
import com.wulian.gateway.feign.impl.UserServiceFallbackImpl;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

// 配置FeignClient，以基于RPC调用wulian-user的内部接口
@FeignClient(value = "wulian-user", fallback = UserServiceFallbackImpl.class, configuration = FeignConfigInterceptor.class)
public interface UserService {

	@GetMapping("/userRest/getUserInfo")
	public UserDto getUserInfo();

	@PostMapping("userRest/sys/login")
	public ResultMoudel<Object> login(@RequestBody UserVO userVo);

	@GetMapping("menu/userMenuByApp")
	public Object userMenuByApp(@RequestParam(value = "userToken") String userToken);

	@PostMapping("userRest/sys/loginByApp")
	public AppResultMoudel<Object> loginApp(@RequestBody UserVO userVo);

	@PostMapping("userRest/sys/inspectionLogin")
	public AppResultMoudel<Object> inspectionLogin(@RequestBody UserVO userVo);

	@PostMapping("userRest/sys/sendSms")
	public ResultMoudel sendSms(@RequestBody UserVO userVo);

	@PostMapping("userRest/sys/updatePasswordByApp")
	public ResultMoudel updatePasswordByApp(@RequestBody UserVO userVo);

	@ApiResponses(value = { @ApiResponse(code = 200, message = "查询用户信息") })
	@PostMapping("userRest/queryUser")
	SysUser queryUser(@RequestBody SysUser sysUser);

	@PostMapping("userRest/sys/sendInspectionSms")
	ResultMoudel sendInspectionSms(UserVO userVo);
}
